﻿<Window x:Class="ResourceBlender_Express.WinEditRBT"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender_Express"
    xmlns:validators="clr-namespace:ResourceBlender_Express.Validators"
    xmlns:props="clr-namespace:ResourceBlender_Express.Properties"
    loc:WindowService.EscapeClosesWindow="True" Loaded="Window_Loaded"
    Title="Edit Translations" WindowStartupLocation="CenterOwner"
    Height="600" Width="700" MinHeight="450" MinWidth="350"
    Style="{StaticResource {x:Type Window}}" Icon="/ResourceBlender-Express;component/Resources/images/resourceblender.ico" ResizeMode="CanResize" WindowState="Maximized">
    <Window.CommandBindings>
        <CommandBinding Command="loc:ResourceBlenderCommands.AutoTranslate" Executed="AutoTranslate" />
        <CommandBinding Command="loc:ResourceBlenderCommands.AutoSave" Executed="ToggleAutoSave" />
        <CommandBinding Command="loc:ResourceBlenderCommands.OpenFullEditor" Executed="ShowFullEditor" />
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow" />
        <CommandBinding Command="ApplicationCommands.Help" Executed="ShowHelp" />
        <CommandBinding Command="ApplicationCommands.Save" Executed="Save" CanExecute="CanExecuteSave"  />
        <CommandBinding Command="NavigationCommands.GoToPage" Executed="GoToTranslation" />
        <CommandBinding Command="NavigationCommands.Favorites" Executed="ShowShortcuts" />
        <CommandBinding Command="NavigationCommands.NextPage" Executed="MoveElement" CanExecute="CanMoveNext" />
        <CommandBinding Command="NavigationCommands.PreviousPage" Executed="MoveElement" CanExecute="CanMovePrevious" />
    </Window.CommandBindings>
    <Window.InputBindings>
        <KeyBinding Command="ApplicationCommands.Save" Gesture="Ctrl+S" />
        <KeyBinding Command="NavigationCommands.GoToPage" Gesture="Ctrl+R" />
        <KeyBinding Command="NavigationCommands.NextPage" Gesture="Alt+Down" />
        <KeyBinding Command="NavigationCommands.PreviousPage" Gesture="Alt+Up" />
    </Window.InputBindings>
    <Window.Resources>
        <BitmapImage x:Key="database_16" UriSource="pack://application:,,,/Resources/images/database_16.png" />
        <Image x:Key="save_16" Source="pack://application:,,,/Resources/images/save_16.png" />
        <Image x:Key="question_16" Source="pack://application:,,,/Resources/images/question_16.png" />
        <props:Settings x:Key="settings" />
    </Window.Resources>
    <DockPanel LastChildFill="True" DataContext="{StaticResource settings}">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Header="_Save" Command="ApplicationCommands.Save" Icon="{StaticResource save_16}" />
                <MenuItem Header="_AutoSave" x:Name="itmAutoSave" Command="loc:ResourceBlenderCommands.AutoSave" IsCheckable="True" IsChecked="{Binding Path=Default.AutoSave,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  />
                <MenuItem Header="E_xit" Command="ApplicationCommands.Close" />
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="_Editing RBT Files" Command="ApplicationCommands.Help" Icon="{StaticResource question_16}" />
                <MenuItem Header="_Shortcut Keys" Command="NavigationCommands.Favorites" />
            </MenuItem>
        </Menu>
        <StatusBar DockPanel.Dock="Bottom" Height="24">
            <DockPanel LastChildFill="True">
                <Image DockPanel.Dock="Left" Source="{StaticResource database_16}" />
                <TextBlock x:Name="lblDb" DockPanel.Dock="Left" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" />
                <TextBlock x:Name="lblStatus" DockPanel.Dock="Right" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap">Loading Summary</TextBlock>
                <ProgressBar x:Name="prgStatus" DockPanel.Dock="Left" IsIndeterminate="True" MinWidth="40" Visibility="Hidden" />
            </DockPanel>
        </StatusBar>
        <Grid DockPanel.Dock="Bottom" Margin="6" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="200" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="2*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="2*" />
            </Grid.RowDefinitions>
            
            <ListView Grid.Row="0" Grid.Column="0" x:Name="lstGrid" TabIndex="0" GridViewColumnHeader.Click="OnColumnHeaderClick"
                      SelectionMode="Single" SelectionChanged="lstGrid_SelectionChanged" SelectedValuePath="ID" ScrollViewer.CanContentScroll="True"
                      VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" ScrollViewer.IsDeferredScrollingEnabled="True">
                <ListView.Resources>
                    <Style TargetType="{x:Type TextBlock}">
                        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
                        <Setter Property="TextTrimming" Value="CharacterEllipsis" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
                                <Setter Property="ToolTipService.IsEnabled" Value="False" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ListView.Resources>
                <ListView.View>
                    <GridView x:Name="grdResources">
                        <GridViewColumn Header="ID">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate DataType="ID">
                                    <TextBlock Style="{StaticResource FullWidthTextBlock}" Text="{Binding ID}" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
            <GridSplitter Grid.Row="0" Grid.Column="1" ResizeDirection="Columns" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
            <ScrollViewer Grid.Row="0" Grid.Column="2">
                <DockPanel Margin="4,4,0,4">
                    <TextBlock DockPanel.Dock="Top" FontWeight="Bold">Comment</TextBlock>
                    <TextBlock DockPanel.Dock="Top" x:Name="txtComment" Margin="5,2,0,2" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" />
                    <TextBlock DockPanel.Dock="Top" FontWeight="Bold">Used By</TextBlock>
                    <TreeView DataContext="{Binding RelativeSource={RelativeSource Self}}" IsTabStop="False">
                        <TreeViewItem Header="Used By" x:Name="treElement" />
                    </TreeView>
                </DockPanel>
            </ScrollViewer>
            
            <GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" ResizeDirection="Rows" HorizontalAlignment="Stretch" />
            <ScrollViewer Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" VerticalScrollBarVisibility="Auto">
                <StackPanel x:Name="stkTranslations" HorizontalAlignment="Stretch" Margin="4,2,4,2">
                    
                </StackPanel>
            </ScrollViewer>
        </Grid>
    </DockPanel>
</Window>
